package com.ruoyi.edu.service.impl;

import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.edu.mapper.EduTeacherMapper;
import com.ruoyi.edu.domain.EduTeacher;
import com.ruoyi.edu.service.IEduTeacherService;

import java.util.List;

/**
 * 讲师Service业务层处理
 *
 * @author niruichen
 * @date 2020-12-22
 */
@Service
public class EduTeacherServiceImpl extends ServiceImpl<EduTeacherMapper, EduTeacher> implements IEduTeacherService {

    @Override
    public List<EduTeacher> queryList(EduTeacher eduTeacher) {
        LambdaQueryWrapper<EduTeacher> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(eduTeacher.getName())){
            lqw.like(EduTeacher::getName, eduTeacher.getName());
        }
        if (eduTeacher.getLevel() != null){
            lqw.eq(EduTeacher::getLevel, eduTeacher.getLevel());
        }
        return this.list(lqw);
    }
}
